<template>
	<view class="creative">
		<view class="uni-list">
			<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(value,key) in listData" :key="key" @click="goDetail(value)">
				<view class="uni-media-list">
					<image class="uni-media-list-logo" :src="value.cover"></image>
					<view class="uni-media-list-body">
						<view class="uni-media-list-text-top">{{value.title}}</view>
						<view class="uni-media-list-text-bottom">
							<text>{{value.author_name}}</text>
							<text>{{value.published_at}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		wholeCaseList
	} from '@/apis/index.js';
	export default {
		data() {
			return {
				listData: [{
						"title": 'aaa',
						"author_name": "bbbb",
						"published_at": "ccc"
					},
					{
						"title": 'aaa',
						"author_name": "bbbb",
						"published_at": "ccc"
					},
					{
						"title": 'aaa',
						"author_name": "bbbb",
						"published_at": "ccc"
					},
					{
						"title": 'aaa',
						"author_name": "bbbb",
						"published_at": "ccc"
					}
				]
			}

		},
		methods: {
			goDetail(value) {
				console.log(value)
			},getList() {
				wholeCaseList({
					currentPage: 1,
					perPage: 10
				}).then(res => {
					let [err, data] = res;
					for (const arr of data.data.data) {
						// console.log("data",data.data.data)
						let arrData = {}
						let tagsData = []
						let obj = JSON.parse(arr.tags);
						for (let i in obj) {
							tagsData.push(obj[i])
						}
						arrData.tag = tagsData[0]
						// this.contentList.pic=arr.pic
						arrData.title = arr.title
						arrData.author = arr.author
						this.listData.push(arrData)
					}
				})
			},
		},
		mounted() {
			this.getList()
		}
	}
</script>
<style lang="scss" scoped>
	.creative {
		background: #F4F4F4;
		height: 100vh;

		.uni-list {
			background-color: #FFFFFF;
			position: relative;
			width: 100%;
			display: flex;
			flex-direction: column;

			.uni-list-cell {
				position: relative;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
			}

			.uni-list-cell-hover {
				background-color: #eee;
			}
		}

		.uni-list:after {
			position: absolute;
			z-index: 10;
			right: 0;
			bottom: 0;
			left: 0;
			height: 1px;
			content: '';
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
			background-color: #c8c7cc;
		}

		.uni-list::before {
			position: absolute;
			z-index: 10;
			right: 0;
			top: 0;
			left: 0;
			height: 1px;
			content: '';
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
			background-color: #c8c7cc;
		}
	}
</style>
